﻿<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
<script type="text/javascript" src="../lib/html5.js"></script>
<script type="text/javascript" src="../lib/respond.min.js"></script>
<script type="text/javascript" src="../lib/PIE_IE678.js"></script>
<![endif]-->
    <link href="../css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link href="../css/H-ui.admin.css" rel="stylesheet" type="text/css" />
    <link href="../lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
    <!--[if IE 6]>
<script type="text/javascript" src="../lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
    <title>生产农事明细日志</title>
    <style type="text/css">
        .auto-style1 {
            width: 40px;
        }
    </style>
</head>
<body>
    <div class="pd-5">
        <div class="form form-horizontal" id="findfdiv">
            <div class="row cl">
                <div class="col-1"></div>
                <div class="col-2">
                    <span class="select-box">
                        <select class="select" size="1" name="findinfotype_d" id="findinfotype_d">
                        </select></span>
                </div>
                <div class="col-2">
                    <span class="select-box">
                        <select class="select" size="1" name="findareaid" id="findareaid"></select>
                    </span>
                </div>
                <div class="col-2">
                    <input type="text" class="input-text" placeholder="地块编号" id="findareadcno" name="findareadcno">
                </div>
                <div class="col-2">
                    <input type="text" class="input-text" placeholder="任务编号" id="findtaskno" name="findtaskno">
                </div>
            </div>
            <div class="row cl">
                <div class="col-1"></div>

                <div class="col-2">
                    <input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" placeholder="作业时间" id="findinfodt1_times" name="findinfodt1_times" class="input-text Wdate">
                </div>
                <div class="col-2">
                    <input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" placeholder="作业时间" id="findinfodt1_timee" name="findinfodt1_timee" class="input-text Wdate">
                </div>
                <div class="col-1"></div>
                <div class="col-3">
                    <button onclick="findreolad()" class="btn btn-success radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 查询</button>
                </div>
                <div class="col-1"></div>
            </div>
        </div>
        <div class="cl pd-5 bg-1 bk-gray mt-5">
            <span class="l">
                <!-- <a href="javascript:;" onclick="toolAddWORK()" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe639;</i> 记录生产农事</a>-->
            </span>
            <span class="r">操作提示：<strong>^_^</strong> </span>

        </div>
        <div class="mt-5 ml-20">
            <table class="table table-border table-bordered table-striped table-hover" id="tablelist" width="100%">
                <thead>
                    <tr class="text-c">
                        <th width="30"><a id="hcmtable_sall" onclick="hcmtable_sall();" href="javascript:;" title="全选反选"><i class="Hui-iconfont">&#xe608;全</i></a></th>
                        <th>任务编号</th>
                        <th>区域</th>
                        <th>地块</th>
                        <th>品种</th>
                        <th>作业类型</th>
                        <th>作业时间</th>
                        <th>作业面积</th>
                        <th>作业人员</th>
                        <th>任务状态</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                </tbody>
            </table>
        </div>
    </div>
    <script src="../hcjsui/Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="../lib/layer/1.9.3/layer.js"></script>
    <script type="text/javascript" src="../lib/laypage/1.2/laypage.js"></script>
    <script type="text/javascript" src="../lib/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="../lib/datatables/1.10.0/jtable.js"></script>
    <script src="../hcjsui/js/_Define.js" type="text/javascript"></script>
    <script type="text/javascript" src="../js/hcui.js"></script>
    <script type="text/javascript" src="../js/hcui_list.js"></script>
    <script type="text/javascript">
        function toolAddWORK() {
            toolAdd("记录生产农事信息", "sctasklist-worknew-ae.html?action=add");
        }
        function getDateByChange(date, days) {
            if (days == undefined || days == '') {
                days = 1;
            }
            var date = new Date(date);
            date.setHours(date.getHours() - days);
            return date;

        }
        $(function () {
            spsetBaseNoBt("viewtask_allltask", "id", "viewtask_allltask as T", "*", "#tablelist", "sctaskworkloglist", "农事作业", "sctasklist-worknew");
            //加载区域
            hcdoselbyPost("id,fv1 as name", "yw_baseinfo", "type='5' and  maintype='5' and databranchid=" + HCUser.HCUorg, "", "", "id", function (data) {
                SetSelectWithArrayIdName("#findareaid", data, "选择区域");
            });
            //作业类型
            hcdoselbyPost("fv3 as id,fv1 as name", "yw_baseinfo", "type='4' and  maintype='4'", "", "", "id", function (data) {
                SetSelectWithArrayIdName("#findinfotype_d", data, "选择作业类型");
            });
            $("#findinfodt1_times").val((getDateByChange(new Date(), 24 * 60)).Format("yyyy-MM-dd"));

            hcmtable = $("#tablelist").DataTable({
                "serverSide": true,//服务端处理分页 无法使用当前查找
                "bFilter": false,  //是否使用内置的过滤功能
                "bInfo": true, "fnDrawCallback": function () { dTappendSkipPage(); },
                "bLengthChange": false, //改变每页显示数据数量
                "ajax": {
                    "type": "POST",
                    "url": spselUrl("and workdatabranchid=" + HCUser.HCUorg + " and   (infotype =0 or( infotype>=2 and infotype<=14))  ") + "&sporderby=infodt1 desc ",
                    "data": function (d) {
                        $("#findfdiv").find("input[type='text']").each(function () {
                            d[this.id] = $(this).val();
                        });
                        $("#findfdiv").find("select").each(function () {
                            d[this.id] = $(this).val();
                        });

                    }
                },
                "order": [[1, "asc"]],//默认第几个排序
                aLengthMenu: [10, 20, 50],
                "columns": [
                    { "data": "rowhcindex" }, { "data": "taskno" }, { "data": "areaname" }, { "data": "areadcno" }, { "data": "tasksctypename" }, { "data": "listinfoname" }, { "data": "infodt1" }, { "data": "infonv1" }, { "data": "infofv3" }, { "data": "taskstatus" }, { "data": "listid" }
                ],

                "columnDefs": [
                       {
                           "targets": [10],
                           "render": function (data, type, row) {
                               if (row.taskstatus == '完成' || row.taskstatus == '中止') {
                                   if (row.infotype == 8)
                                       return "<a style=\"text-decoration:none\" class=\"ml-5\" onClick=\"toolUpdateByIdCheckUrl('" + data + "','sctasklist-worknewdf-ae.html','处理作业信息')\" href=\"javascript:;\" title=\"查看\"><i class=\"Hui-iconfont\">&#xe6df;查看</i></a> ";
                                   else return "<a style=\"text-decoration:none\" class=\"ml-5\" onClick=\"toolUpdateByIdCheckUrl('" + data + "','sctasklist-worknewdf-ae.html','处理作业信息')\" href=\"javascript:;\" title=\"查看\"><i class=\"Hui-iconfont\">&#xe685;查看</i></a> ";
                               }
                               else {

                                   return "<a style=\"text-decoration:none\" class=\"ml-5\" onClick=\"toolUpdateByIdCheckUrl('" + data + "','sctasklist-worknewdf-ae.html','处理作业信息')\" href=\"javascript:;\" title=\"编辑\"><i class=\"Hui-iconfont\">&#xe6df;编辑</i></a> " +
                                      "<a style=\"text-decoration:none\" class=\"ml-5\" onClick=\"toolDelete('" + data + "','hsc_task_info','id')\"     href=\"javascript:;\" title=\"删除\"><i class=\"Hui-iconfont\">&#xe6e2;删除</i></a>";
                               }
                           }
                       },
                         {
                             "targets": [1],
                             "render": function (data, type, row) {
                                 if (data != null && data != "")
                                     return data + "<a style=\"text-decoration:none\" class=\"ml-5\" title='生产基地农事记录表' onClick=\"toolAddMain('生产基地农事记录表','../hsctask/re_taskworkAllShow.html?taskno=" + escape(data) + "')\"     href=\"javascript:;\" title=\"删除\"><i class=\"Hui-iconfont\">&#xe603;查看</i></a>"
                                 else return "";
                             }
                         },

                    //不排序
                   {
                       "orderable": false,
                       "targets": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
                   }

                ]
            });
        });
        //通用标准的toolAdd 
        function toolAddMain(t, url, w, h) {
            if (url == null || url == '') {
                url = spPageHtmlName + "-ae.html?action=add";
            };
            if (t == null || t == '') {
                t = "新增" + pPageInfoName + "信息";
            };

            if (w == null || w == '' || w == 'undefined') {
                var index = parent.layer.open({
                    type: 2,
                    title: t,
                    content: url,
                    //cancel: function (index) {//关闭
                    //    layer.close(index);
                    //},
                    //success: function (layero, index) {
                    //    console.log(layero, index);
                    //},
                    //yes: function (index) {
                    //    //do something
                    //    layer.close(index); //一般设定yes回调，必须进行手工关闭
                    //},
                    end: function () {
                        findreolad("sdivclosed");
                    }
                });
                parent.layer.full(index);
            }
            else {
                if (w == null || w == '') {
                    w = 800;
                };
                if (h == null || h == '') {
                    h = ($(window).height() - 50);
                };
                layer.open({
                    type: 2,
                    area: [w + 'px', h + 'px'],
                    fix: false,
                    maxmin: true,
                    shade: 0.4,
                    title: t,
                    content: url,
                    end: function () {
                        findreolad("sdivclosed");
                    }
                });

            }
        }
    </script>
</body>
</html>
